<script setup lang="ts">
import { inject } from 'vue'
import BlockCard from '@/components/BlockCard.vue'
import Price from '@/components/Price.vue'

const $toast: any = inject('$toast', () => {})

const onClickLink = () => $toast('修改地址')
const onSubmit = () => {
  $toast('提交订单')
}
</script>
<template>
  <div class="handle-order">
    <BlockCard  @click="$router.push('/addressList')">
      <div class="user-address">
        <div>
          <span style="margin-right: 20px;">张三</span>
          <span>13144445555</span>
          <block class="van-ellipsis">湖北省xx市xx街道xx办事处xx号</block>
        </div>
        <van-icon name="arrow" />
      </div>
    </BlockCard>
    <BlockCard>
      <van-card
        v-for="item in 3"
        :key="item"
        num="2"
        tag="标签"
        price="2.00"
        desc="描述信息"
        title="商品标题"
        thumb="https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg"
        origin-price="10.00"
        lazy-load
      />
    </BlockCard>
    <BlockCard title="明细">
      <van-cell title="商品总价" value-class="value-text">
        <template #value>
          <Price value="10.00" />
        </template>
      </van-cell>
      <van-cell title="邮费" value-class="value-text" is-link>
        <template #value>
          <Price value="8.00" />
        </template>
      </van-cell>
      <van-cell title="合计" value-class="value-text">
        <template #value>
          <Price value="18.00" />
        </template>
      </van-cell>
    </BlockCard>
    <van-submit-bar :price="3050" button-text="提交订单" @submit="onSubmit">
      <template #tip>
        你的收货地址不支持配送, <span style="color: #1989fa;" @click="onClickLink">修改地址</span>
      </template>
    </van-submit-bar>
  </div>
</template>
<style lang="scss" scoped>
.handle-order {
  padding-bottom: 20vh;
  .user-address {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 30px;
  }
  .van-card {
    margin-top: 0px;
  }
  :deep(.value-text) {
    color: var(--color-text-price);
  }
}
</style>